home *** CD-ROM | disk | FTP | other *** search
/ Aminet 23 / Aminet 23 (1998)(GTI - Schatztruhe)[!][Feb 1998].iso / Aminet / comm / www / autoindex2c.lha / GfxCON_scale.rex < prev    next >
OS/2 REXX Batch file  |  1997-07-06  |  2KB  |  76 lines

  1. /************************************/
  2. /* GfxCON                           */
  3. /* by Matthias Finger               */
  4. /* Scale a given image by any size. */
  5. /************************************/
  6. test=0 /* Just to test the script from a shell (test=1) for use with autoindex: test=0 */
  7.  
  8. /* Only make changes here in the next 4 lines */
  9.  
  10. GFXCON="dh1:utils/GfxCon_68020 "            /* Path for GfxCON (SPACE reqiered) */
  11. FORM="GIF"                                  /* Format for destination pictiure  */
  12. /* FORM="JPEG" */
  13. QUALITY=85                                  /* Quality for jpeg destination     */
  14. VERBOSE=0                                   /* Verbose: 1=OFF, 0=ON             */ 
  15. OTHER=""                                    /* Other options for GfxCON         */
  16.  
  17. /* ------- You should know what you do, if you change anything below -------- */
  18. Options results
  19. signal on error         /* Setup a place for errors to go */
  20. if arg()==0 then exit
  21.  
  22. PARSE ARG source dest sizex sizey .
  23.  
  24. IF(test==1) THEN DO
  25.   say GFXCON
  26.   say FORM
  27.   say QUALITY
  28.   say OTHER
  29.   say VERBOSE
  30.   say source
  31.   say dest
  32.   say sizex
  33.   say sizey
  34. END
  35. ELSE DO
  36.   /* strip off the " character at the begin and end of the strings */
  37.   source= LEFT(source, LENGTH(source)-1)
  38.   source=RIGHT(source, LENGTH(source)-1)
  39.   dest = left(dest,length(dest)-1)
  40.   dest = right(dest,length(dest)-1)
  41. END
  42.  
  43. IF ~EXISTS(dest) THEN DO
  44.   call pragma("STACK",22000)
  45.   comm = GFXCON||source
  46.     IF(VERBOSE==1) THEN
  47.       comm = comm||' >NIL:'
  48.   comm = comm||' TO '||dest||' FORMAT 'FORM
  49.     IF (UPPER(FORM)=="JPEG") THEN DO
  50.     comm = comm||' QUALITY 'QUALITY||' '
  51.   END
  52.   comm = comm||' '||OTHER||' BOXFIT '||sizex||' '||sizey
  53.   IF (test==1) THEN
  54.     say "comm3: "comm
  55.   ADDRESS COMMAND comm
  56. END
  57.  
  58. EXIT
  59.  
  60. /*******************************************************************/
  61. /* This is where control goes when an error code is returned by IE */
  62. /* It puts up a message saying what happened and on which line     */
  63. /*******************************************************************/
  64. error:
  65. if RC=5 then do         /* Did the user just cancel us? */
  66.    LAST_ERROR
  67.    'REQUEST "'||RESULT||'"'
  68.    exit
  69. end
  70. else do
  71.    LAST_ERROR
  72.    'REQUEST "Error detected!!!'||D2C(10)||'GfxCON error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  73.    exit
  74. end
  75.  
  76.